import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/Login/login.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "/home",
    name: "home",
    component: () => import("../views/HomeView.vue"),
    children: [
      {
        path: "/welcome",
        name: "welcome",
        component: () => import("../views/Welcome/welcome.vue"),
      },
      {
        path: "/users",
        name: "users",
        component: () => import("../views/Users/users.vue"),
      },
      {
        path: "/roles",
        name: "roles",
        component: () => import("../views/Roles/roles.vue"),
      },
      {
        path: "/rights",
        name: "rights",
        component: () => import("../views/Rights/rights.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});
export default router;
